import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import RankView from '../views/RankView.vue'
import SongList from '../components/songlist/SongList.vue';
import SingerHome from '../components/singer/SingerHome.vue'
import MeView from '../views/MeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/rank',
    name: 'rank',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
     component: RankView
    // () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/songlist/:id', //动态路由,带路径参数的路由
    name: 'songlist',
    component: SongList
  },
  {
    path: '/singer/desc/:id', //动态路由,带路径参数的路由
    name: 'SingerHome',
    component: SingerHome
  },
  {
    path: '/me', 
    name: 'me',
    component: MeView
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
